<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, 
		minimum-scale=1.0, maximum-scale=1.0"/>
		<link href="../public/css/style.css" rel="stylesheet">
		<link href="../public/css/common.css" rel="stylesheet">
		<script type="text/javascript" src="../public/js/jquery.js" ></script>
		<script type="text/javascript" src="../public/js/product.js" ></script>
	</head>
	<body class="layout_body">
		<div class="layout_content login-bg ">
			<div class="titleImg" style="padding-top: 35px;"><img src="../public/img/login_icon.png"/></div>
			<div class="titleImg"><img src="../public/img/login_text.png"/></div>
			<div class="loginName">
				<img src="../public/img/login_username.png" class="img-middle">
				<input class="input" id="userName" type="text" placeholder="请输入账号" maxlength="30" required>
				<a class="clear" onclick="javascript:document.getElementById('userName').value=''"></a>
			</div>
			
			<div class="loginPwd">
				<img src="../public/img/login_pwd.png" class="img-middle">
				<input class="input" id="userPwd" type="password" placeholder="请输入密码" maxlength="30" required>
				<a class="clear" onclick="javascript:document.getElementById('userPwd').value=''"></a>
			</div>
			<div style="text-align:center;">
				<input  id="btn" class="loginBtn" type="button" value="登录">  
			</div>
			<div class="login-width div-center" style="font-size: 0.85em;">
				<div class="flt">立即试用</div>
			    <div class="frt">忘记密码？</div>
			</div>
			<div class="login-bottom">
				<img src="../public/img/login_call_icon.png" class="img-middle img-padding"/><a href="tel:4000285927">4000285927</a>
			</div>
			<div id="tip" class="tip"></div>
			<div id="incommit" class="div-center disn" style="width: 115px;position: relative;">
				<img src="../public/js/layer/skin/default/loading-2.gif" class="img-padding1"/>
			    <div class="commitloading">提交中...</div>
			</div>
			<div id="fade" class="black_overlay"></div>
		</div>
		<script type="text/javascript">
			$('#btn').click(function(){
				var userName = $('#userName').val();
				var userPwd = $('#userPwd').val();
				//validate 去空，不能是标签
				if(userName=="" || userPwd==""){
					$('#tip').html('账号或密码为空');
					Tip();
					return false;
				}
				$.ajax({
				  type: "post", 
				  url : "/login/index", 
				  dataType:'json',
				  data:{'userName':userName,'userPwd':userPwd},
				  success: function(info){
					  var msg = info.msg;
					  if(!isNull(msg)&&msg =='dataNull'){
						  $('#tip').html('登录失败');
						  Tip();
						  return false;
					  }else if(!isNull(msg)&&msg == 'dataError'){
						  $('#tip').html('输入错误');
						  Tip();
						  return false;
					  }else if(!isNull(msg)&&msg =='success'){
						  location.href="/"
						  // $('#btn').attr("disabled", true);
						  return false;
					  }else if(!isNull(msg)&& msg =="fail"){
						  $('#tip').html('用户名或密码错误');
						  Tip();
						  return false;
					  }else{
						  $('#tip').html('登录失败');
						  Tip();
						  return false;
					  }
				  },
				  error:function(){
					  $('#tip').html('登录失败！');
					  Tip();
				  }
				});
				setTimeout("$('#fade').hide();$('#incommit').addClass('disn');",1500);
			});
		</script>
	</body>
</html>
